<!DOCTYPE html>
<html lang="en">

<head>
	<{include file="header.html" }>
		<title>发布视频课-
			<{$user_data[ 'school_name']}>-德安信会计在线教育平台</title>
		<link href="/static/public/webupload/webuploader.css" rel="stylesheet">
</head>
<script type="text/javascript">
	var dire = 'user';
	var thumb = 'big_thumb,middle_thumb,small_thumb';
	var fileNumLimit = 6;
</script>
<body>
	<div class="wrap">
		<!--star left-->
		<div class="column">
			<{include file="left_menu.html" }>
		</div>
		<div id="ContMianBox">
			<!--star子栏目-->
			<div class="sub-colum">
                <div class="tit"><{$left_menu_min.menu}></div>
                <ul>
                    <{foreach from=$left_menu_min.list item=item}>
                    <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                    <{/foreach}>
                </ul>
            </div>
			<!--end子栏目-->
			<!--end left-->
			<div class="container narrow">
				<!--star conter-->
				<div class="cetContent">
					<div class="tit p-lr20">
						<a class="c-40d064" href="/course">视频课</a><em class="p-lr10 c-CCCCCC fs12">/</em><em>发布视频课</em>
					</div>
				</div>
				<!--star内容区域-->
				<div class="mainScroll">
					<div class="mainContainer line-all">
						<ul class="ui-nav-tab wList33">
							<li class="js-step-1 active"><a href="javascript:;">1.编辑课程基本信息</a></li>
							<li class="js-step-2"><a href="/course/edit_video_subject/<{$course['id']|default:'0'}>">2.编辑课程目录</a></li>
						</ul>
						<div class="tabMainCont">
							<!--star 编辑课程基本信息-->
							<div class="tabItem step-01">
								<!-- <input type="hidden" id="token" value="<{$token}>"> -->
								<form class="layui-form" method="post" action="/course/shipinke_publish">
								<div class="line-all p20">
										<input type="hidden" name="id" value="<{$course['id']|default:'0'}>" />
										<div class="layui-form-item">
											<label class="layui-form-label">课程分类：</label>
											<div class="layui-input-inline">
												<select name="cate_id" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
													<option value="">课程分类</option>
													<{foreach from=$cate item=item}>
														<option value="<{$item.id}>" <{if $course['cate_id']|default:"" == $item.id}>selected="selected"<{/if}>><{$item.name}></option>
													<{/foreach}>
												</select>
											</div>
											<div class="layui-form-mid layui-word-aux"><{if empty($cate)}>还没有课程分类，请<a href="/course/cate_publish" class="c-52a1fa">添加课程分类</a><{/if}></div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">课程科目：</label>
											<div class="layui-input-inline">
												<select name="subject_id" lay-verify="required" id="subject" placeholder="请选择" lay-filter="subject">
													<option value="">请选择科目</option>
													<{if isset($subject)}>
													<{foreach from = $subject item=item}>
													<option <{if $item.id == $course['subject_id'] }>selected="selected"<{/if}> value="<{$item.id}>"><{$item.name}></option>
													<{/foreach}>
													<{/if}>
												</select>
											</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">主讲老师：</label>
											<div class="layui-input-inline">
												<select name="teacher_id" lay-verify="required" id="teacher" placeholder="请选择" lay-filter="teacher">
													<option value="">主讲老师</option>
													<{foreach from=$teacher item=item}>

														<option value="<{$item.id}>" <{if $course['teacher_id']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.teacher_name}></option>
													<{/foreach}>
												</select>
											</div>
											<div class="layui-form-mid layui-word-aux">从学校老师中选择，为添加老师请先添加，　<a href="/teacher/teacher_add"  class="c-52a1fa">添加老师</a></div>
										</div>
										<div class="layui-form-item">
											<div class="layui-inline">
												<label class="layui-form-label">课程名称：</label>
												<div class="layui-input-block">
													<input type="text" value="<{$course['title']|default:""}>" name="title" placeholder="课程名称" required lay-verify="required" autocomplete="off" class="layui-input" style="width: 800px;">
												</div>
											</div>
										</div>
										<div class="layui-form-item layui-form-text">
											<input type="hidden" id="token" value="<{'VIMG'|get_qiniu_token}>" />
											<label class="layui-form-label">封面图</label>
											<div class="layui-input-block" style="margin-top: 5px;">
												<div id="uploader2" class="upload_box" style="float:left; width:420px;">
													<div class="queueList">
														<div id="dndArea2" class="placeholder dndArea">
															<div id="filePicker2" class="filePicker"></div>
															<p>或将照片拖到这里，最多可上传<script>document.write(fileNumLimit);</script>张图片</p>
														</div>
													</div>
													<div class="statusBar" style="display:none;">
														<div class="progress">
															<span class="text">0%</span>
															<span class="percentage"></span>
														</div><div class="info"></div>
														<div class="btns">
															<div id="filePickerBut2" class="filePickerBut"></div><div class="uploadBtn">开始上传</div>
														</div>
													</div>
													<div class="upload_img_input" input_name='img_url[]'></div>
												</div>
												<{if isset($news_info['news_images']) AND $news_info['news_images'] != ''}>
													<div class="layui-inline" style="float:left;"><img src="<{$news_info['news_images']}>" style="max-height:175px;"/></div>
												<{/if}>
											</div>
										</div>
										<div class="layui-form-item layui-form-text">
											<input type="hidden" id="token" value="<{'VIMG'|get_qiniu_token}>" />
											<label class="layui-form-label">试看视频</label>
											<div class="layui-input-block" style="padding-top: 10px;">
												
												<a href="javascript:;" class="add_video" onclick="sel_video(this)">+选择视频</a>
												<div class="sel_video">
													<p><{$video_title|default:''}></p><input type="hidden" class="selected" name="vid" value="<{$course.vid|default:0}>">
												</div>
											</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">课时:</label>
											<div class="layui-input-inline">
												<input type="number" lay-verify="number" value="<{$course['course_time']|default:""}>" placeholder="请输入课时" name="course_time"  autocomplete="off" class="layui-input">
											</div>
											<div class="layui-form-mid layui-word-aux">课时</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">价格:</label>
											<div class="layui-input-inline">
												<input type="text" value="<{$course['price']|default:""}>" placeholder="请输入价格" name="price" lay-verify="required" autocomplete="off" class="layui-input">
											</div>
											<div class="layui-form-mid layui-word-aux">元</div>
											<label class="layui-form-label">佣金:</label>
											<div class="layui-input-inline">
												<input type="text" value="<{$course['commission']|default:""}>" placeholder="请输入佣金百分比" name="commission" lay-verify="required" autocomplete="off" class="layui-input">
											</div>
											<div class="layui-form-mid layui-word-aux">%</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">VIP免费:</label>
											<input type="checkbox" value="1" <{if $course['is_free']|default:0 eq 1}>checked<{/if}> name="is_free" title="免费" lay-skin="primary">
												<div class="layui-unselect layui-form-checkbox layui-form-checked" lay-skin="primary"><span>免费</span><i class="layui-icon"></i>
												</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">推荐该课程:</label>
											<div class="layui-input-inline">
											<input type="checkbox" value="1" <{if $course['is_recomend']|default:0 eq 1}>checked<{/if}> name="is_recomend" title="推荐" lay-skin="primary">
											</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">有效期:</label>
											<div class="layui-input-inline">
												<input type="number" lay-verify="number" value="<{$course['effective_time']|default:""}>" placeholder="请输入有效期" name="effective_time" lay-verify="required" autocomplete="off" class="layui-input">
											</div>
											<div class="layui-form-mid layui-word-aux">天</div>
										</div>

										<div class="layui-form-item">
											<label class="layui-form-label">课程收益:</label>
											<div class="layui-input-block">
												<input type="text" value="<{$course['learn_what']|default:""}>" placeholder="请输入学到什么" name="learn_what" lay-verify="required" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">适合人群:</label>
											<div class="layui-input-block">
												<input type="text" value="<{$course['suitable']|default:""}>" placeholder="请输入适合人群" name="suitable" lay-verify="required" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div class="layui-form-item layui-form-text">
											<label class="layui-form-label">课程详情：</label>
											<div class="layui-input-block">
													<textarea name="detail" id="detail" placeholder="请输入详情" class="editor layui-textarea"><{$course.detail|default:''}></textarea>
											</div>
										</div>


										<div class="p-tb30 tac">
											<button class="layui-btn layui-btn-normal" lay-submit lay-filter="*">发布课程并编辑科目</button>
										</div>
								</div>


							</form>

							</div>
							<!--end 编辑课程基本信息-->

						</div>


					</div>
				</div>


				<{include file="footer.html"}>
				<!--end内容区域-->
				<!-- <script type="text/javascript" src="/static/public/webupload/webuploader.js"></script> -->
				<!-- <script type="text/javascript" src="/static/public/webupload/upload_for_school.js"></script> -->
				<script>
					$(function() {

						layui.use(['form','layedit','jquery'], function() {
							var form = layui.form();
							$ = layui.jquery;
							//监听提交
							form.on('submit(formDemo)', function(data) {
								layer.msg(JSON.stringify(data.field));
								return false;
							});
							form.on('select(cate_id)', function(data){
								var ii = layer.load();
								var id = data.value;
								$("#course_id").html('<option value="">请选择科目</option>');
								form.render('select');
							    $.ajax({
									type: "POST",
									url: "/course/get_cate_subject",
									data: {id:id},
									dataType: "json",
									success: function (data) {
										var ddl = $("#subject");
										var html ='<option value="">请选择科目</option>';
										$(data).each(function (key) {
											html += "<option value='"+data[key].id+"'>"+data[key].name+"</option>";
										});
										$("#subject").html(html);
										form.render('select');
										layer.close(ii);
									}
								});
							});  
						});


					})
					function sel_video(obj) {
						//alert($(".add_video").length);
						var index = $(obj).parent().index(".add_video");
						var vid = $(obj).closest("dd").find(".save").attr("vid");
						layer.open({
							type: 2,
							area: ['730px', '530px'],
							fixed: false, //不固定
							maxmin: true,
							content: '/course/select_video/0/0/0/0/0/' + index + '/' + vid
						});
					}
				</script>
			</div>
		</div>
</body>

</html>
